package org.example;

import org.apache.hadoop.fs.*;

import java.io.IOException;
import java.util.Arrays;

public class 文件和文件夹判断 {
    public static void main(String[] args) throws IOException {
        String pathLocal = HdfsClient文件的更名和移动.class.getClassLoader().getResource("").getPath();


        try (FileSystem fs = HadoopConnectUtil.getFileSystem()) {
            FileStatus[] listFiles = fs.listStatus(new Path("/"));
            for (int i = 0; i < listFiles.length; i++) {
                FileStatus listFile = listFiles[i];
                if (listFile.isFile()) {
                    System.out.println("文件:" + listFile.getPath().getName());
                } else if (listFile.isDirectory()) {
                    System.out.println("目录:" + listFile.getPath().getName());
                }
            }

        }
    }
}

